clear all 

*global root="Replication file"

use "$root/Data/main_data.dta"


///////////////////////////////
//Table 1: Descriptive Stats/// 
///////////////////////////////

preserve 
keep if sex==2

est clear 
generate y = uniform()
sort year
by year: eststo: quietly regress y employed age white hispanic nchild, nocons
estadd summ : *
esttab using "$root/Results/table1_A.tex", main(mean) aux(sd) label nodepvar nostar nonote

*for married women: 
est clear 
sort year
by year: eststo: quietly regress y married, nocons
estadd summ : *
esttab using "$root/Results/table1_B.tex", main(mean) aux(sd) label nodepvar nostar nonote
restore 

///////////////////////////////////////////////////
//Table 2: Laws on Female Gainful Employment //////
///////////////////////////////////////////////////
preserve 

keep if sex==2

*panel A: 

est clear 
did_multiplegt_old employed state year seating_law_control , graphoptions(nodraw) robust_dynamic dynamic(3) average_effect placebo(0) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_S1) 
did_multiplegt_old employed state year seating_law_control, graphoptions(nodraw) robust_dynamic dynamic(3) average_effect placebo(0) controls(age race hispan) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_S2) 
did_multiplegt_old employed state year seating_law_control if restricted_sample==1, graphoptions(nodraw) robust_dynamic dynamic(3) average_effect placebo(0) controls(age race hispan) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_S3) 

did_multiplegt_old employed state year seating_law_years , graphoptions(nodraw) robust_dynamic dynamic(3) average_effect placebo(0) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_S4) 
did_multiplegt_old employed state year seating_law_years , graphoptions(nodraw) robust_dynamic dynamic(3) controls(age race hispan) average_effect placebo(0) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_S5) 
did_multiplegt_old employed state year seating_law_years if restricted_sample==1, graphoptions(nodraw) robust_dynamic dynamic(3) controls(age race hispan) average_effect placebo(0) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_S6) 



est clear 
did_multiplegt_old employed state year prohibitory_law_control, graphoptions(nodraw) robust_dynamic dynamic(3) average_effect placebo(0) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_P1) 
did_multiplegt_old employed state year prohibitory_law_control , graphoptions(nodraw) robust_dynamic dynamic(3) average_effect placebo(0) controls(age race hispan) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_P2) 
did_multiplegt_old employed state year prohibitory_law_control if  restricted_sample==1, graphoptions(nodraw) robust_dynamic dynamic(3) average_effect placebo(0) controls(age race hispan) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_P3) 

did_multiplegt_old employed state year regulatory_years , graphoptions(nodraw) robust_dynamic dynamic(3) average_effect placebo(0) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_P4) 
did_multiplegt_old employed state year regulatory_years , graphoptions(nodraw) robust_dynamic dynamic(3) controls(age race hispan) average_effect placebo(0) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_P5) 
did_multiplegt_old employed state year regulatory_years if  restricted_sample==1, graphoptions(nodraw) robust_dynamic dynamic(3) controls(age race hispan) average_effect placebo(0) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_P6) 


est clear 
did_multiplegt_old employed state year night_work_law_control , graphoptions(nodraw) robust_dynamic dynamic(3) average_effect placebo(0) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_N1) 
did_multiplegt_old employed state year night_work_law_control , graphoptions(nodraw) robust_dynamic dynamic(3) average_effect placebo(0) controls(age race hispan) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_N2) 
did_multiplegt_old employed state year night_work_law_control if restricted_sample==1, graphoptions(nodraw) robust_dynamic dynamic(3) average_effect placebo(0) controls(age race hispan) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_N3) 

did_multiplegt_old employed state year nightwork_years , graphoptions(nodraw) robust_dynamic dynamic(3) average_effect placebo(0) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_N4) 
did_multiplegt_old employed state year nightwork_years , graphoptions(nodraw) robust_dynamic dynamic(3) controls(age race hispan) average_effect placebo(0) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_N5) 
did_multiplegt_old employed state year nightwork_years if restricted_sample==1, graphoptions(nodraw) robust_dynamic dynamic(3) controls(age race hispan) average_effect placebo(0) breps(200) cluster(state) seed(1) save_results($root/Results/table2_A_N6) 


*panel B: 
est clear 
eststo: quietly reg employed seating_law_control i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_years  i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year if  restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/table2_B_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


est clear 
eststo: quietly reg employed prohibitory_law_control i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm


eststo: quietly reg employed regulatory_years  i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year if  restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/table2_B_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

est clear 
eststo: quietly reg employed night_work_law_control i.state i.year  ,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year  if  restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed nightwork_years  i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year  if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/table2_B_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))



restore 



/////////////////////////////////////////
//Table 3: pre-passage and other_laws///
////////////////////////////////////////

*Panel A: Seating laws

preserve
keep if sex==2
//merging with pre-passage characteristics for treated states only 
drop _merge 
merge m:1 STATE using "$root/Data/seating_falsification.dta",force
drop _merge 
merge m:m STATE year using "$root/Data/other_laws.dta" 
drop _merge

global Industrialization "South share_manufac share_women_manufac share_clerical_women_employed"
global Individual "age race hispan"


est clear 

eststo: quietly reg employed seating_law_control  $Individual $Industrialization  NWP      dum_KnightofLabor     i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control  $Individual $Industrialization NWP      dum_KnightofLabor     i.year if restricted_sample==1 ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control $Individual equal_pay_control suffrage maximum_hours_control i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control $Individual equal_pay_control suffrage maximum_hours_control i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm


eststo: quietly reg employed seating_law_years  $Individual $Industrialization NWP      dum_KnightofLabor     i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years  $Individual $Industrialization  NWP      dum_KnightofLabor     i.year if restricted_sample==1 ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years $Individual equal_pay_control suffrage maximum_hours_control i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years $Individual equal_pay_control suffrage maximum_hours_control i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/table3_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))
restore 


*Panel B: Regulatory laws

preserve
keep if sex==2
//merging with pre-passage characteristics for treated states only 
drop _merge 
merge m:1 STATE using "$root/Data/regulatory_falsification.dta",force
drop _merge 
merge m:m STATE year using "$root/Data/other_laws.dta" 
drop _merge

global Industrialization "South share_manufac share_women_manufac share_clerical_women_employed"
global Individual "age race hispan"

est clear 

eststo: quietly reg employed prohibitory_law_control  $Individual $Industrialization  NWP      dum_KnightofLabor     i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control  $Individual $Industrialization NWP      dum_KnightofLabor     i.year if restricted_sample==1 ,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control $Individual equal_pay_control suffrage maximum_hours_control i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control $Individual equal_pay_control suffrage maximum_hours_control i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm


eststo: quietly reg employed regulatory_years  $Individual $Industrialization NWP      dum_KnightofLabor     i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years  $Individual $Industrialization  NWP      dum_KnightofLabor     i.year if restricted_sample==1 ,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years $Individual equal_pay_control suffrage maximum_hours_control i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years $Individual equal_pay_control suffrage maximum_hours_control i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/table3_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))
restore 


*Panel C: Nightwork laws

preserve
keep if sex==2
//merging with pre-passage characteristics for treated states only 
drop _merge 
merge m:1 STATE using "$root/Data/nightwork_falsification.dta",force
drop _merge 
merge m:m STATE year using "$root/Data/other_laws.dta" 
drop _merge

global Industrialization "South share_manufac share_women_manufac share_clerical_women_employed"
global Individual "age race hispan"

est clear 

eststo: quietly reg employed night_work_law_control  $Individual $Industrialization  NWP      dum_KnightofLabor     i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control  $Individual $Industrialization NWP      dum_KnightofLabor     i.year if restricted_sample==1 ,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control $Individual equal_pay_control suffrage maximum_hours_control i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control $Individual equal_pay_control suffrage maximum_hours_control i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm


eststo: quietly reg employed nightwork_years  $Individual $Industrialization NWP      dum_KnightofLabor     i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years  $Individual $Industrialization  NWP      dum_KnightofLabor     i.year if restricted_sample==1 ,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years $Individual equal_pay_control suffrage maximum_hours_control i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years $Individual equal_pay_control suffrage maximum_hours_control i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/table3_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))
restore 





/////////////////////////////////////////
//Table 4: Industry triple differences///
////////////////////////////////////////

preserve
keep if sex==2

  *collapsing data
gen pop=1
bys state year: egen total_women=sum(pop)
drop employed_women
bys state year industry: egen employed_women=sum(employed)
contract year state industry total_women employed_women

drop _freq


decode state,gen(STATE)
merge m:m STATE year industry using "$root/Data/state_year_industry"


drop state 
encode STATE, gen(state)
sort state year total_women

bysort state year: replace total_women= total_women[1] if total_women==.
replace employed_women=0 if employed_women==.



*outcome var:
gen share_women=employed_women/total_women 
gen log_employed_women=log(1+employed_women)
encode industry, gen(industry_fe)
egen industry_state = concat (industry_fe state)
gen log_share_women=log(1+share_women)

est clear
eststo: quietly reg share_women seating_law_ind i.industry_fe i.year i.state,cluster(industry_state)
estadd ysumm
eststo: quietly reg share_women seating_law_ind i.industry_fe i.year##i.state,cluster(industry_state)
estadd ysumm
eststo: quietly reg share_women seating_law_ind i.industry_fe##i.year i.year##i.state,cluster(industry_state)
estadd ysumm

eststo: quietly reg share_women seating_years_ind i.industry_fe i.year i.state,cluster(industry_state)
estadd ysumm
eststo: quietly reg share_women seating_years_ind i.industry_fe i.year##i.state,cluster(industry_state)
estadd ysumm
eststo: quietly reg share_women seating_years_ind i.industry_fe##i.year i.year##i.state,cluster(industry_state)
estadd ysumm

esttab  using "$root/Results/table4_seating.tex", keep(seating_law_ind seating_years_ind) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010)  stats(N ymean ysd, fmt(%9.0fc 2))

est clear
eststo: quietly reg share_women regulatory_law_ind i.industry_fe i.year i.state,cluster(industry_state)
estadd ysumm
eststo: quietly reg share_women regulatory_law_ind i.industry_fe i.year##i.state,cluster(industry_state)
estadd ysumm
eststo: quietly reg share_women regulatory_law_ind i.industry_fe##i.year i.year##i.state,cluster(industry_state)
estadd ysumm

eststo: quietly reg share_women regulatory_years_ind i.industry_fe i.year i.state,cluster(industry_state)
estadd ysumm
eststo: quietly reg share_women regulatory_years_ind i.industry_fe i.year##i.state,cluster(industry_state)
estadd ysumm
eststo: quietly reg share_women regulatory_years_ind i.industry_fe##i.year i.year##i.state,cluster(industry_state)
estadd ysumm

esttab  using "$root/Results/table4_regulatory.tex", keep(regulatory_law_ind regulatory_years_ind) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))



est clear
eststo: quietly reg share_women nightwork_law_ind i.industry_fe i.year i.state,cluster(industry_state)
estadd ysumm
eststo: quietly reg share_women nightwork_law_ind i.industry_fe i.year##i.state,cluster(industry_state)
estadd ysumm
eststo: quietly reg share_women nightwork_law_ind i.industry_fe##i.year i.year##i.state,cluster(industry_state)
estadd ysumm

eststo: quietly reg share_women nightwork_years_ind i.industry_fe i.year i.state,cluster(industry_state)
estadd ysumm
eststo: quietly reg share_women nightwork_years_ind i.industry_fe i.year##i.state,cluster(industry_state)
estadd ysumm
eststo: quietly reg share_women nightwork_years_ind i.industry_fe##i.year i.year##i.state,cluster(industry_state)
estadd ysumm

esttab  using "$root/Results/table4_nightwork.tex", keep(nightwork_law_ind nightwork_years_ind) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010)  stats(N ymean ysd, fmt(%9.0fc 2))

restore 





/////////////////////////////////////////////////
//Table 5: Marital Status Heterogeneity//////////  
////////////////////////////////////////////////

preserve 
keep if sex==2

gen With_children=1 if nchild!=0
replace With_children=0 if nchild==0



est clear 
eststo: quietly reg employed seating_law_control age race hispan  i.state i.year  if married==0 ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan  i.state i.year  if married==0 & restricted_sample==1 ,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_control age race hispan  i.state i.year if married==1 & With_children==0 ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan  i.state i.year if married==1 & With_children==0 & restricted_sample==1 ,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_control age race hispan  i.state i.year if married==1 & With_children==1 ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan  i.state i.year if married==1 & With_children==1 & restricted_sample==1,cluster(state)
estadd ysumm
esttab  using "$root/Results/table5_A_seating.tex", keep(seating_law_control ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))



est clear 
eststo: quietly reg employed  prohibitory_law_control age race hispan i.state i.year  if married==0 ,cluster(state)
estadd ysumm
eststo: quietly reg employed  prohibitory_law_control age race hispan i.state i.year  if married==0 & restricted_sample==1 ,cluster(state)
estadd ysumm

eststo: quietly reg employed  prohibitory_law_control age race hispan i.state i.year  if married==1 & With_children==0 ,cluster(state)
estadd ysumm
eststo: quietly reg employed  prohibitory_law_control age race hispan i.state i.year  if married==1 & With_children==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed  prohibitory_law_control age race hispan i.state i.year  if married==1 & With_children==1,cluster(state)
estadd ysumm
eststo: quietly reg employed  prohibitory_law_control age race hispan i.state i.year  if married==1 & With_children==1 & restricted_sample==1,cluster(state)
estadd ysumm
esttab  using "$root/Results/table5_A_regulatory.tex", keep(prohibitory_law_control ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))




est clear
eststo: quietly reg employed  night_work_law_control age race hispan i.state i.year  if married==0 ,cluster(state)
estadd ysumm
eststo: quietly reg employed  night_work_law_control age race hispan i.state i.year  if married==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed  night_work_law_control age race hispan i.state i.year if married==1 & With_children==0 ,cluster(state)
estadd ysumm
eststo: quietly reg employed  night_work_law_control age race hispan i.state i.year if married==1 & With_children==0 & restricted_sample==1 ,cluster(state)
estadd ysumm

eststo: quietly reg employed  night_work_law_control age race hispan i.state i.year  if married==1 & With_children==1,cluster(state)
estadd ysumm
eststo: quietly reg employed  night_work_law_control age race hispan i.state i.year  if married==1 & With_children==1 & restricted_sample==1,cluster(state)
estadd ysumm
esttab  using "$root/Results/table5_A_nightwork.tex", keep(night_work_law_control ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


*Panel B: Continuous measure

est clear
eststo: quietly reg employed c.seating_law_years age race hispan i.state i.year  if married==0 ,cluster(state)
estadd ysumm
eststo: quietly reg employed c.seating_law_years age race hispan i.state i.year  if married==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed c.seating_law_years age race hispan i.state i.year if married==1 & With_children==0  ,cluster(state)
estadd ysumm
eststo: quietly reg employed c.seating_law_years age race hispan i.state i.year if married==1 & With_children==0  & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed c.seating_law_years age race hispan i.state i.year  if married==1 & With_children==1 ,cluster(state)
estadd ysumm
eststo: quietly reg employed c.seating_law_years age race hispan i.state i.year  if married==1 & With_children==1 & restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/table5_B_seating.tex", keep( seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


est clear 
eststo: quietly reg employed  c.regulatory_years age race hispan i.state i.year  if married==0 ,cluster(state)
estadd ysumm
eststo: quietly reg employed  c.regulatory_years age race hispan i.state i.year  if married==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed  c.regulatory_years age race hispan i.state i.year  if married==1 & With_children==0 ,cluster(state)
estadd ysumm
eststo: quietly reg employed  c.regulatory_years age race hispan i.state i.year  if married==1 & With_children==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed  c.regulatory_years age race hispan i.state i.year  if married==1 & With_children==1 ,cluster(state)
estadd ysumm
eststo: quietly reg employed  c.regulatory_years age race hispan i.state i.year  if married==1 & With_children==1 & restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/table5_B_regulatory.tex", keep( regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))



est clear 
eststo: quietly reg employed  c.nightwork_years age race hispan i.state i.year if married==0 ,cluster(state)
estadd ysumm
eststo: quietly reg employed  c.nightwork_years age race hispan i.state i.year if married==0 & restricted_sample==1 ,cluster(state)
estadd ysumm

eststo: quietly reg employed  c.nightwork_years age race hispan i.state i.year  if married==1 & With_children==0,cluster(state)
estadd ysumm
eststo: quietly reg employed  c.nightwork_years age race hispan i.state i.year  if married==1 & With_children==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed  c.nightwork_years age race hispan i.state i.year  if married==1 & With_children==1,cluster(state)
estadd ysumm 
eststo: quietly reg employed  c.nightwork_years age race hispan i.state i.year  if married==1 & With_children==1 & restricted_sample==1,cluster(state)
estadd ysumm
esttab  using "$root/Results/table5_B_nightwork.tex", keep( nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

restore







/////////////////////////////////////////////////
//Table 6: Social Status Heterogeneity//////////  
////////////////////////////////////////////////
preserve 
keep if sex==2

gen dwelling=1 if ownershp==1
replace dwelling=0 if ownershp==2


est clear 
eststo: quietly reg employed seating_law_control##dwelling marst age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed  prohibitory_law_control##dwelling marst  age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed  night_work_law_control##dwelling  marst age race hispan i.state i.year ,cluster(state)
estadd ysumm

eststo: quietly reg employed c.seating_law_years##dwelling marst age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed  c.regulatory_years##dwelling marst  age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed  c.nightwork_years##dwelling  marst age race hispan i.state i.year ,cluster(state)
estadd ysumm

esttab  using "$root/Results/table6_panel A.tex", b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))



gen Literacy_2=1 if lit==4
replace Literacy_2=0 if lit==1|lit==2|lit==3


est clear 
eststo: quietly reg employed seating_law_control##Literacy_2 age race hispan  i.state i.year  ,cluster(state)
estadd ysumm
eststo: quietly reg employed  prohibitory_law_control##Literacy_2  age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed  night_work_law_control##Literacy_2 age race hispan i.state i.year ,cluster(state)
estadd ysumm

eststo: quietly reg employed c.seating_law_years##Literacy_2 age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed  c.regulatory_years##Literacy_2 age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed  c.nightwork_years##Literacy_2 age race hispan i.state i.year ,cluster(state)
estadd ysumm

esttab  using "$root/Results/table6_panel_B.tex", b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


restore







///////////////////////////////////////////////
//Table A3: Marital Status and Fertility///////
///////////////////////////////////////////////

preserve 

keep if sex==2 

gen age_mother= age - eldch if eldch!=99


**Panel A: Binary regressions: 

est clear 
eststo: quietly reg married seating_law_control age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg married seating_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg divorced seating_law_control age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg divorced seating_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg nchild seating_law_control age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg nchild seating_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg age_mother seating_law_control age race hispan i.state i.year if age_mother>14 & age_mother<45,cluster(state)
estadd ysumm
eststo: quietly reg age_mother seating_law_control age race hispan i.state i.year if age_mother>14 & age_mother<45 & restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA3_A_seating.tex", keep(seating_law_control ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))



est clear 
eststo: quietly reg married prohibitory_law_control age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg married prohibitory_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg divorced prohibitory_law_control age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg divorced prohibitory_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg nchild prohibitory_law_control age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg nchild prohibitory_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg age_mother prohibitory_law_control age race hispan i.state i.year if age_mother>14 & age_mother<45,cluster(state)
estadd ysumm
eststo: quietly reg age_mother prohibitory_law_control age race hispan i.state i.year if  age_mother>14 & age_mother<45 & restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA3_A_regulatory.tex", keep(prohibitory_law_control ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))



est clear 
eststo: quietly reg married night_work_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg married night_work_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg divorced night_work_law_control age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg divorced night_work_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg nchild night_work_law_control age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg nchild night_work_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg age_mother night_work_law_control age race hispan i.state i.year if  age_mother>14 & age_mother<45,cluster(state)
eststo: quietly reg age_mother night_work_law_control age race hispan i.state i.year if  age_mother>14 & age_mother<45 & restricted_sample==1,cluster(state)

esttab  using "$root/Results/tableA3_A_nightwork.tex", keep(night_work_law_control ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))



**Panel B: Continuous regressions 
est clear 
eststo: quietly reg married seating_law_years age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg married seating_law_years age race hispan i.state i.year if restricted_sample==1 ,cluster(state)
estadd ysumm

eststo: quietly reg divorced seating_law_years age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg divorced seating_law_years age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg nchild seating_law_years age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg nchild seating_law_years age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg age_mother seating_law_years age race hispan i.state i.year if age_mother>14 & age_mother<45,cluster(state)
estadd ysumm
eststo: quietly reg age_mother seating_law_years age race hispan i.state i.year if age_mother>14 & age_mother<45 & restricted_sample==1,cluster(state)
estadd ysumm


esttab  using "$root/Results/tableA3_B_seating.tex", keep(seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


est clear 
eststo: quietly reg married regulatory_years age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg married regulatory_years age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg divorced regulatory_years age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg divorced regulatory_years age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg nchild regulatory_years age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg nchild regulatory_years age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg age_mother regulatory_years age race hispan i.state i.year  if  age_mother>14 & age_mother<45,cluster(state)
eststo: quietly reg age_mother regulatory_years age race hispan i.state i.year  if  age_mother>14 & age_mother<45 & restricted_sample==1,cluster(state)

esttab  using "$root/Results/tableA3_B_regulatory.tex", keep( regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


est clear 
eststo: quietly reg married nightwork_years age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg married nightwork_years age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg divorced nightwork_years age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg divorced nightwork_years age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg nchild nightwork_years age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg divorced nightwork_years age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm


eststo: quietly reg age_mother nightwork_years age race hispan i.state i.year if age_mother>14 & age_mother<45,cluster(state)
eststo: quietly reg age_mother nightwork_years age race hispan i.state i.year if age_mother>14 & age_mother<45 & restricted_sample==1,cluster(state)

esttab  using "$root/Results/tableA3_B_nightwork.tex", keep( nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

restore




/////////////////////////////////////////
//Table A4: Revisions & Reinforcements/// 
/////////////////////////////////////////


**seating laws: 
preserve 

keep if sex==2 

drop _merge 
merge m:1 STATE year_seating_law using "$root/Data/seating_reinforcement.dta"

gen seating_law_reinforcement=1 if seating_law==1 & year_seating_law_2<year
replace seating_law_reinforcement=2 if seating_law==1 & year_seating_law_3<year
replace seating_law_reinforcement=3 if seating_law==1 & year_seating_law_4<year
replace seating_law_reinforcement=4 if seating_law==1 & year_seating_law_5<year
replace seating_law_reinforcement=5 if seating_law==1 & year_seating_law_6<year
replace seating_law_reinforcement=6 if seating_law==1 & year_seating_law_7<year
replace seating_law_reinforcement=7 if seating_law==1 & year_seating_law_8<year
replace seating_law_reinforcement=8 if seating_law==1 & year_seating_law_9<year
replace seating_law_reinforcement=9 if seating_law==1 & year_seating_law_10<year
replace seating_law_reinforcement=10 if seating_law==1 & year_seating_law_11<year
replace seating_law_reinforcement=11 if seating_law==1 & year_seating_law_12<year
replace seating_law_reinforcement=0 if seating_law_reinforcement==.


est clear 
eststo: qui reg employed  seating_law_reinforcement age race hispan i.state i.year  ,cluster(state)
estadd ysumm
eststo: qui reg employed  seating_law_reinforcement age race hispan i.state i.year if restricted_sample==1  ,cluster(state)
estadd ysumm
 
esttab  using "$root/results/tableA4_seating.tex",  keep(seating_law_reinforcement)  b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))
restore 



**regulatory laws: 
preserve
keep if sex==2 

drop _merge
merge m:1 STATE year_prohibitory_law using "$root/Data/regulatory_reinforcement.dta"

gen regulatory_law_reinforcement=1 if prohibitory_law==1 & year_prohibitory_law_2<year
replace regulatory_law_reinforcement=2 if prohibitory_law==1 & year_prohibitory_law_3<year
replace regulatory_law_reinforcement=3 if prohibitory_law==1 & year_prohibitory_law_4<year
replace regulatory_law_reinforcement=4 if prohibitory_law==1 & year_prohibitory_law_5<year
replace regulatory_law_reinforcement=5 if prohibitory_law==1 & year_prohibitory_law_6<year
replace regulatory_law_reinforcement=6 if prohibitory_law==1 & year_prohibitory_law_7<year
replace regulatory_law_reinforcement=7 if prohibitory_law==1 & year_prohibitory_law_8<year
replace regulatory_law_reinforcement=8 if prohibitory_law==1 & year_prohibitory_law_9<year
replace regulatory_law_reinforcement=9 if prohibitory_law==1 & year_prohibitory_law_10<year
replace regulatory_law_reinforcement=0 if regulatory_law_reinforcement==.

est clear 
eststo: qui reg employed  regulatory_law_reinforcement age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: qui reg employed  regulatory_law_reinforcement age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/results/tableA4_regulatory.tex",   keep(regulatory_law_reinforcement) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2)) 
restore 
 


**night-work laws:
preserve 
keep if sex==2

drop _merge
merge m:1 STATE year_night_work using "$root/Data/nightwork_reinforcement.dta"

gen NWL_law_reinforcement=1 if night_work_laws==1 & year_night_work_2<year
replace NWL_law_reinforcement=0 if NWL_law_reinforcement==.
replace NWL_law_reinforcement=2 if  night_work_laws==1 & year_night_work_3<year
replace NWL_law_reinforcement=3 if  night_work_laws==1 & year_night_work_4<year
replace NWL_law_reinforcement=4 if  night_work_laws==1 & year_night_work_5<year
replace NWL_law_reinforcement=5 if  night_work_laws==1 & year_night_work_6<year
replace NWL_law_reinforcement=6 if  night_work_laws==1 & year_night_work_7<year
replace NWL_law_reinforcement=7 if  night_work_laws==1 & year_night_work_8<year
replace NWL_law_reinforcement=8 if  night_work_laws==1 & year_night_work_9<year
replace NWL_law_reinforcement=9 if  night_work_laws==1 & year_night_work_10<year

est clear 
eststo: qui reg employed  NWL_law_reinforcement age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: qui reg employed  NWL_law_reinforcement age race hispan i.state i.year if restricted_sample==1 ,cluster(state)
estadd ysumm
    
  
esttab  using "$root/results/tableA4_nightwork.tex", keep(NWL_law_reinforcement) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2)) 
restore





/////////////////////////////////////////
//Table A5: Restricting post treatment/// 
/////////////////////////////////////////

preserve 
keep if sex==2 


//within 2 decades after treatment only 
est clear 
eststo: quietly reg employed seating_law_control i.state i.year if seating_law_years<=2,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year if seating_law_years<=2,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year if restricted_sample==1 & seating_law_years<=2,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_years  i.state i.year if seating_law_years<=2,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year if seating_law_years<=2 ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year if  restricted_sample==1 & seating_law_years<=2,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA5_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


est clear 
eststo: quietly reg employed prohibitory_law_control i.state i.year if regulatory_years<=2,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year if regulatory_years<=2,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year if restricted_sample==1 & regulatory_years<=2,cluster(state)
estadd ysumm


eststo: quietly reg employed regulatory_years  i.state i.year if regulatory_years<=2,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year if regulatory_years<=2,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year if  restricted_sample==1 & regulatory_years<=2,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA5_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

est clear 
eststo: quietly reg employed night_work_law_control i.state i.year if nightwork_years<=2 ,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year if nightwork_years<=2,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year  if  restricted_sample==1 & nightwork_years<=2,cluster(state)
estadd ysumm

eststo: quietly reg employed nightwork_years  i.state i.year if nightwork_years<=2,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year if nightwork_years<=2,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year  if restricted_sample==1 & nightwork_years<=2,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA5_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

restore 


///////////////////////////////////////////////
//Table A6: Predicting Year of Passage/////////
//////////////////////////////////////////////

preserve 

clear
use "$root/Data/seating_falsification_panel.dta"

*predicting year of passage: seating law
est clear
eststo: quietly reg year_seating_law South share_manufac share_women_manufac  share_clerical_women_employed  NWP    dum_KnightofLabor   , cluster(state)
estadd ysumm

*predicting year of passage: prohibitory law
clear 
use "$root/Data/regulatory_falsification_panel.dta"
eststo: quietly reg year_prohibitory_law South share_manufac share_women_manufac  share_clerical_women_employed  NWP    dum_KnightofLabor , cluster(state) 
estadd ysumm

*predicting year of passage: night work law
clear 
use "$root/Data/nightwork_falsification_panel.dta"
eststo: quietly reg year_night_work South share_manufac share_women_manufac  share_clerical_women_employed  NWP    dum_KnightofLabor , cluster(state)
estadd ysumm

esttab using "$root/Results/tableA6.tex", se(3) ar2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

restore 



/////////////////////////////////////////////////////////////
//Table A7: Complementarity Check and Early Adopters////////
///////////////////////////////////////////////////////////


//////Complementarity check 
preserve 
keep if sex==2 


gen RL=1 if prohibitory_law_control==1 & year_prohibitory_law<year_seating_law
replace RL=0 if RL==.
gen NWL=1 if night_work_law_control==1 & year_night_work<year_seating_law
replace NWL=0 if NWL==.


*Seating laws:
est clear 
eststo: quietly reg employed seating_law_control RL NWL age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control RL NWL age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_years RL NWL age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years RL NWL age race hispan i.state i.year if restricted_sample==1 ,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA7_complementarity_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010)  stats(N ymean ysd, fmt(%9.0fc 2))

*** regulatory laws:
gen SL=1 if seating_law_control==1 & year_seating_law<year_prohibitory_law
replace SL=0 if SL==.
drop NWL
gen NWL=1 if night_work_law_control==1 & year_night_work<year_prohibitory_law
replace NWL=0 if NWL==.


est clear 
eststo: quietly reg employed prohibitory_law_control SL NWL age race hispan  i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control SL NWL age race hispan  i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed regulatory_years SL NWL age race hispan  i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years SL NWL age race hispan  i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA7_complementarity_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010)  stats(N ymean ysd, fmt(%9.0fc 2))


***nightwork laws: 
drop SL
gen SL=1 if seating_law_control==1 & year_seating_law<year_night_work
replace SL=0 if SL==.
drop RL
gen RL=1 if prohibitory_law_control==1 & year_prohibitory_law<year_night_work
replace RL=0 if RL==.
 
est clear 
eststo: quietly reg employed night_work_law_control SL RL age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control SL RL age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm


eststo: quietly reg employed nightwork_years SL RL age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years SL RL age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm


esttab  using "$root/Results/tableA7_complementarity_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010)  stats(N ymean ysd, fmt(%9.0fc 2))

restore 


//////Early Adopters 

preserve 

keep if sex==2

keep if year<=1900

est clear 
eststo: quietly reg employed seating_law_control age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year if  restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA7_early_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


est clear 
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year if  restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA7_early_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

est clear 
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year  if  restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year  if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA7_early_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

restore 







//////////////////////////////////////////////////////
//Table A8: Immigration & Economic Development////////
//////////////////////////////////////////////////////

preserve 

keep if sex==2 

drop _merge 
merge m:1 statefip year using "$root/Data/econ_characteristics.dta"

drop _merge

*Panel A: Seating 
est clear 
eststo: quietly reg employed seating_law_control age race hispan male_LFPstate i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan male_LFPstate i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan occscore_state i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan occscore_state i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan share_FB_women i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan share_FB_women i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA8_A_seating.tex", keep(seating_law_control) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))

*Panel B: Seating 
est clear 
eststo: quietly reg employed seating_law_years age race hispan male_LFPstate i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan male_LFPstate i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan occscore_state i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan occscore_state i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan share_FB_women i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan share_FB_women i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA8_B_seating.tex", keep( seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))


est clear 
eststo: quietly reg employed prohibitory_law_control age race hispan male_LFPstate i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan male_LFPstate i.state i.year if restricted_sample==1 ,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan occscore_state i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan occscore_state i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan share_FB_women i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan share_FB_women i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA8_A_regulatory.tex", keep(prohibitory_law_control ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2)) 


est clear 
eststo: quietly reg employed regulatory_years age race hispan male_LFPstate i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan male_LFPstate i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan occscore_state i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan occscore_state i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan share_FB_women i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan share_FB_women i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA8_B_regulatory.tex", keep( regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))


est clear 
eststo: quietly reg employed night_work_law_control age race hispan male_LFPstate i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan male_LFPstate i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan occscore_state i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan occscore_state i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan share_FB_women i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan share_FB_women i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA8_A_nightwork.tex", keep(night_work_law_control ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2)) 


est clear 

eststo: quietly reg employed nightwork_years age race hispan male_LFPstate i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan male_LFPstate i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan occscore_state i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan occscore_state i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan share_FB_women i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan share_FB_women i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm
esttab  using "$root/Results/tableA8_B_nightwork.tex", keep( nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))

restore


///////////////////////////////////////////////////////
//Table A9: Instrumental Variables (IV) Strategy////// 
//////////////////////////////////////////////////////

preserve 

keep if sex==2


decode state, gen (State)
drop state
gen state=State
*Define regions 
gen Region="West" if strpos(state, "Hawaii") > 0| strpos(state, "Alaska") > 0| strpos(state, "Arizona") > 0|strpos(state, "California") > 0|strpos(state, "Colorado") > 0|strpos(state, "Idaho") > 0|strpos(state, "Montana") > 0|strpos(state, "New Mexico") > 0|strpos(state, "Nevada") > 0|strpos(state, "Oregon") > 0|strpos(state, "Utah") > 0|strpos(state, "Washington") > 0|strpos(state,"Wyoming")>0
replace Region="South" if strpos(state, "Alabama") > 0|strpos(state, "Arkansas") > 0|strpos(state, "Delaware") > 0|strpos(state, "Florida") > 0|strpos(state, "Georgia") > 0|strpos(state, "Kentucky") > 0|strpos(state, "Louisiana") > 0|strpos(state, "Maryland") > 0|strpos(state, "Mississippi") > 0
replace Region="South" if  strpos(state, "North Carolina") > 0|strpos(state, "Oklahoma") > 0|strpos(state, "South Carolina") > 0|strpos(state, "Tennessee") > 0|strpos(state, "Texas") > 0|strpos(state, "Virginia") > 0|strpos(state,"West Virginia")>0|strpos(state,"District Of Columbia")>0
replace Region="Northeast" if strpos(state,"Connecticut")>0| strpos(state,"Massachusetts")>0|strpos(state,"Maine")>0|strpos(state,"New Hampshire")>0| strpos(state,"New Jersey")>0| strpos(state,"New York")>0|strpos(state,"Pennsylvania")>0|strpos(state,"Rhode Island")>0|strpos(state,"Vermont")>0
replace Region="Midwest" if strpos(state,"Iowa")>0| strpos(state,"Illinois")>0| strpos(state,"Indiana")>0|strpos(state,"Kansas")>0|strpos(state,"Michigan")>0|strpos(state,"Minnesota")>0| strpos(state,"Missouri")>0|strpos(state,"North Dakota")>0|strpos(state,"Nebraska")>0|strpos(state,"South Dakota")>0|strpos(state,"Ohio")>0|strpos(state,"Wisconsin")>0

encode Region,gen(region_no)

*Building instrument: not dropping pioneer state/instrument state
bysort region_no: egen min_year_seating_law=min(year_seating_law)
gen seating_law_control2=1 if seating_law==1 & min_year_seating_law<year
replace seating_law_control2=0 if seating_law_control2==.

bysort region_no: egen min_year_prohibitory_law=min(year_prohibitory_law)
gen prohibitory_law_control2=1 if prohibitory_law==1 & min_year_prohibitory_law<year
replace prohibitory_law_control2=0 if prohibitory_law_control2==.

bysort region_no: egen min_year_night_work=min(year_night_work)
gen night_work_law_control2=1 if night_work_laws==1 & min_year_night_work<year
replace night_work_law_control2=0 if night_work_law_control2==.

*intensity measure: years of exposure to law: Seating Law
gen seating_law_years2=year-min_year_seating_law
replace seating_law_years2=0 if seating_law_years2<0
replace seating_law_years2=0 if seating_law_years2==.

*intensity measure: years of exposure to law: Regulatory Law
gen regulatory_years2=year- min_year_prohibitory_law
replace regulatory_years2=0 if regulatory_years2<0
replace regulatory_years2=0 if regulatory_years2==.

*intensity measure: years of exposure to law: Night work Law
gen nightwork_years2=year- min_year_night_work
replace nightwork_years2=0 if nightwork_years2<0
replace nightwork_years2=0 if nightwork_years2==.

*** Effect in "number of decades NOT years"
replace seating_law_years2=seating_law_years2/10
replace regulatory_years2=regulatory_years2/10
replace nightwork_years2=nightwork_years2/10



est clear 
eststo : xi: ivreg2 employed (seating_law_control = seating_law_control2) age race hispan i.state i.year, cluster(state) first ffirst savefirst savefprefix(e) partial(i.state i.year)
estadd ysumm
eststo : xi: ivreg2 employed (seating_law_control = seating_law_control2) age race hispan i.state i.year  if restricted_sample==1, cluster(state) first ffirst savefirst savefprefix(e) partial(i.state i.year)
estadd ysumm

esttab  using "$root/Results/tableA9_seating.tex",  b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 



est clear 
eststo : xi: ivreg2 employed (prohibitory_law_control = prohibitory_law_control2) age race hispan i.state i.year, cluster(state) first ffirst savefirst savefprefix(e) partial(i.state i.year)
estadd ysumm
 eststo : xi: ivreg2 employed (prohibitory_law_control = prohibitory_law_control2) age race hispan i.state i.year  if  restricted_sample==1, cluster(state) first ffirst savefirst savefprefix(e) partial(i.state i.year)
estadd ysumm

esttab  using "$root/Results/tableA9_regulatory.tex",  b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


est clear 
eststo : xi: ivreg2 employed (night_work_law_control = night_work_law_control2) age race hispan i.state i.year , cluster(state) first ffirst savefirst savefprefix(e) partial(i.state i.year)
estadd ysumm
eststo : xi: ivreg2 employed (night_work_law_control = night_work_law_control2) age race hispan i.state i.year  if restricted_sample==1, cluster(state) first ffirst savefirst savefprefix(e) partial(i.state i.year)
estadd ysumm

esttab  using "$root/Results/tableA9_nightwork.tex", b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

restore 



///////////////////////////////////////
//Table A10: Region Fixed Effects////// 
///////////////////////////////////////
preserve 

keep if sex==2 


est clear 
eststo: quietly reg employed seating_law_control i.region i.year  ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.region i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.region i.year   if  restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years  i.region i.year  ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.region i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.region i.year   if  restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA10_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


est clear 
eststo: quietly reg employed prohibitory_law_control i.region i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.region i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.region i.year   if  restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years  i.region i.year, cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.region i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.region i.year   if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA10_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

est clear 
eststo: quietly reg employed night_work_law_control i.region i.year, cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.region i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.region i.year   if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years  i.region i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.region i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.region i.year if  restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA10_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

restore 



/////////////////////////////////////////
//Table A11: Alternative Inferences////// 
/////////////////////////////////////////

preserve 

keep if sex==2 

*Panel A: Seating laws: 
est clear 
eststo: quietly reg employed seating_law_control i.state i.year ,robust
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year  ,robust
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year  if restricted_sample==1  ,robust
estadd ysumm

eststo: quietly reg employed seating_law_years i.state i.year ,robust
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year  ,robust
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year  if restricted_sample==1  ,robust
estadd ysumm

esttab  using "$root/Results/tableA11_A_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


*Panel A: Regulatory laws: 
est clear 
eststo: quietly reg employed prohibitory_law_control i.state i.year  ,robust
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year ,robust
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year  if  restricted_sample==1,robust
estadd ysumm

eststo: quietly reg employed regulatory_years i.state i.year  ,robust
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year ,robust
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year  if  restricted_sample==1,robust
estadd ysumm


esttab  using "$root/Results/tableA11_A_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


*Panel A: Nightwork laws: 
est clear 
eststo: quietly reg employed night_work_law_control i.state i.year  ,robust
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year  ,robust
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year  if  restricted_sample==1,robust
estadd ysumm

eststo: quietly reg employed nightwork_years i.state i.year  ,robust
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year  ,robust
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year  if  restricted_sample==1,robust
estadd ysumm

esttab  using "$root/Results/tableA11_A_nightwork.tex", keep(night_work_law_control) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))



egen state_year=group(state year)
*Panel B: Seating laws: 
est clear 
eststo: quietly reg employed seating_law_control i.state i.year, cluster(state_year)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year,cluster(state_year)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state_year)
estadd ysumm

eststo: quietly reg employed seating_law_years  i.state i.year, cluster(state_year)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year , cluster(state_year)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year if  restricted_sample==1, cluster(state_year)
estadd ysumm

esttab  using "$root/Results/tableA11_B_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

*Panel B: Regulatory laws: 
est clear 
eststo: quietly reg employed prohibitory_law_control i.state i.year,cluster(state_year)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year,cluster(state_year)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state_year)
estadd ysumm

eststo: quietly reg employed regulatory_years  i.state i.year ,cluster(state_year)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year ,cluster(state_year)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year if  restricted_sample==1,cluster(state_year)
estadd ysumm

esttab  using "$root/Results/tableA11_B_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

*Panel B: Nightwork laws: 
est clear 
eststo: quietly reg employed night_work_law_control i.state i.year  ,cluster(state_year)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year ,cluster(state_year)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year  if  restricted_sample==1,cluster(state_year)
estadd ysumm

eststo: quietly reg employed nightwork_years  i.state i.year,cluster(state_year)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year,cluster(state_year)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year  if restricted_sample==1,cluster(state_year)
estadd ysumm

esttab  using "$root/Results/tableA11_B_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))



*Panel C: Seating laws: 
est clear 
eststo: quietly reg employed seating_law_control i.state i.year  ,cluster(state)
boottest seating_law_control, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	
eststo: quietly reg employed seating_law_control age race hispan i.state i.year ,cluster(state)		
boottest seating_law_control, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	
eststo: quietly reg employed seating_law_control age race hispan i.state i.year if  restricted_sample==1,cluster(state)		
boottest seating_law_control, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	

eststo: quietly reg employed seating_law_years i.state i.year  ,cluster(state)
boottest seating_law_years, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	
eststo: quietly reg employed seating_law_years age race hispan i.state i.year ,cluster(state)		
boottest seating_law_years, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	
eststo: quietly reg employed seating_law_years age race hispan i.state i.year if  restricted_sample==1,cluster(state)		
boottest seating_law_years, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	

esttab  using "$root/Results/tableA11_C_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

*Regulatory Laws
est clear 
eststo: quietly reg employed prohibitory_law_control i.state i.year, cluster(state)
boottest prohibitory_law_control, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year ,cluster(state)	
boottest prohibitory_law_control, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year if  restricted_sample==1,cluster(state)	
boottest prohibitory_law_control, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	

eststo: quietly reg employed regulatory_years i.state i.year, cluster(state)
boottest regulatory_years, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	
eststo: quietly reg employed regulatory_years age race hispan i.state i.year ,cluster(state)	
boottest regulatory_years, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	
eststo: quietly reg employed regulatory_years age race hispan i.state i.year if  restricted_sample==1,cluster(state)	
boottest regulatory_years, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	

esttab  using "$root/Results/tableA11_C_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

* Night Work laws
est clear 
eststo: quietly reg employed night_work_law_control i.state i.year  ,cluster(state)
boottest night_work_law_control, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year ,cluster(state)		
boottest night_work_law_control, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state)		
boottest night_work_law_control, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	

eststo: quietly reg employed nightwork_years i.state i.year  ,cluster(state)
boottest nightwork_years, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	
eststo: quietly reg employed nightwork_years age race hispan i.state i.year ,cluster(state)		
boottest nightwork_years, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	
eststo: quietly reg employed nightwork_years age race hispan i.state i.year if restricted_sample==1,cluster(state)		
boottest nightwork_years, nograph gridpoints(49) seed(12345) reps(9999) boottype(wild)	

esttab  using "$root/Results/tableA11_C_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

restore 




/////////////////////////////////////////////////////
//Table A12: Share of Female Gainful Employment////// 
/////////////////////////////////////////////////////

preserve 

keep if sex==2

gen pop=1

gen employed_restricted=1 if employed==1 & restricted_sample==1
replace employed_restricted=0 if employed_restricted==. & restricted_sample==1
 
bys state year: egen total_women=sum(pop)
drop employed_women
bys state year: egen employed_women=sum(employed)
bys state year: egen employed_women_restricted=sum(employed_restricted)

bys state year: keep if [_n]==1

gen share_women=employed_women/total_women 
gen share_women_restricted=employed_women_restricted/total_women

est clear 
eststo: quietly reg share_women seating_law_control i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg share_women_restricted seating_law_control i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg share_women seating_law_years  i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg share_women_restricted seating_law_years i.state i.year,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA12_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


est clear 
eststo: quietly reg share_women prohibitory_law_control i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg share_women_restricted prohibitory_law_control i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg share_women regulatory_years  i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg share_women_restricted regulatory_years i.state i.year,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA12_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


est clear 
eststo: quietly reg share_women night_work_law_control i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg share_women_restricted night_work_law_control i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg share_women nightwork_years  i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg share_women_restricted nightwork_years i.state i.year,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA12_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

restore 


///////////////////////////////////
//Table A13: Targeted industries///
//////////////////////////////////


preserve
keep if sex==2

  *collapsing data
gen pop=1
bys state year: egen total_women=sum(pop)
drop employed_women
bys state year industry: egen employed_women=sum(employed)
contract year state industry total_women employed_women

drop _freq


decode state,gen(STATE)
merge m:m STATE year industry using "$root/Data/state_year_industry"


drop state 
encode STATE, gen(state)
sort state year total_women

bysort state year: replace total_women= total_women[1] if total_women==.
replace employed_women=0 if employed_women==.



*outcome var:
gen share_women=employed_women/total_women 
gen log_employed_women=log(1+employed_women)
encode industry, gen(industry_fe)
egen industry_state = concat (industry_fe state)
gen log_share_women=log(1+share_women)


*Panel A: binary form 
est clear
eststo: quietly reg share_women seating_law_ind i.year i.state if industry=="mercantile",cluster(state)
estadd ysumm
eststo: quietly reg share_women seating_law_ind i.year i.state if industry=="manufac_durable",cluster(state)
estadd ysumm
eststo: quietly reg share_women seating_law_ind i.year i.state if industry=="manufac_non_durable",cluster(state)
estadd ysumm
eststo: quietly reg share_women seating_law_ind i.year i.state if industry=="services",cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA13_A_seating.tex", keep(seating_law_ind ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))


est clear
eststo: quietly reg share_women regulatory_law_ind  i.year i.state if industry=="manufac_durable",cluster(state)
estadd ysumm
eststo: quietly reg share_women regulatory_law_ind i.year i.state if industry=="manufac_non_durable",cluster(state)
estadd ysumm
eststo: quietly reg share_women regulatory_law_ind i.year i.state if industry=="mining",cluster(state)
estadd ysumm
esttab  using "$root/Results/tableA13_A_regulatory.tex", keep(regulatory_law_ind) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))

est clear
eststo: quietly reg share_women nightwork_law_ind i.year i.state if industry=="mercantile",cluster(state)
estadd ysumm
eststo: quietly reg share_women nightwork_law_ind i.year i.state if industry=="manufac_durable",cluster(state)
estadd ysumm
eststo: quietly reg share_women nightwork_law_ind i.year i.state if industry=="manufac_non_durable",cluster(state)
estadd ysumm
eststo: quietly reg share_women nightwork_law_ind i.year i.state if industry=="services",cluster(state)
estadd ysumm
esttab  using "$root/Results/tableA13_A_nightwork.tex", keep(nightwork_law_ind ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))


*Panel B: continuous
est clear
eststo: quietly reg share_women seating_years_ind i.year i.state if industry=="mercantile",cluster(state)
estadd ysumm
eststo: quietly reg share_women seating_years_ind i.year i.state if industry=="manufac_durable",cluster(state)
estadd ysumm
eststo: quietly reg share_women seating_years_ind i.year i.state if industry=="manufac_non_durable",cluster(state)
estadd ysumm
eststo: quietly reg share_women seating_years_ind i.year i.state if industry=="services",cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA13_B_seating.tex", keep(seating_years_ind ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))


est clear
eststo: quietly reg share_women regulatory_years_ind  i.year i.state if industry=="manufac_durable",cluster(state)
estadd ysumm
eststo: quietly reg share_women regulatory_years_ind i.year i.state if industry=="manufac_non_durable",cluster(state)
estadd ysumm
eststo: quietly reg share_women regulatory_years_ind i.year i.state if industry=="mining",cluster(state)
estadd ysumm
esttab  using "$root/Results/tableA13_B_regulatory.tex", keep(regulatory_years_ind) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))

est clear
eststo: quietly reg share_women nightwork_years_ind i.year i.state if industry=="mercantile",cluster(state)
estadd ysumm
eststo: quietly reg share_women nightwork_years_ind i.year i.state if industry=="manufac_durable",cluster(state)
estadd ysumm
eststo: quietly reg share_women nightwork_years_ind i.year i.state if industry=="manufac_non_durable",cluster(state)
estadd ysumm
eststo: quietly reg share_women nightwork_years_ind i.year i.state if industry=="services",cluster(state)
estadd ysumm
esttab  using "$root/Results/tableA13_B_nightwork.tex", keep(nightwork_years_ind ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))

restore 


////////////////////////////////////////
//Table A14: Male Gainful Employment /// 
////////////////////////////////////////

preserve 

keep if sex==1 

est clear 
eststo: quietly reg employed seating_law_control i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated seating_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_years  i.state i.year  ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated seating_law_years age race hispan i.state i.year ,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA14_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


est clear 
eststo: quietly reg employed prohibitory_law_control i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated prohibitory_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm

eststo: quietly reg employed regulatory_years  i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated regulatory_years age race hispan i.state i.year ,cluster(state)
estadd ysumm


esttab  using "$root/Results/tableA14_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))


est clear 
eststo: quietly reg employed night_work_law_control i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated night_work_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm

eststo: quietly reg employed nightwork_years  i.state i.year  ,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year  ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated nightwork_years age race hispan i.state i.year ,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA14_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

restore 




///////////////////////////////////////////////
//Table A15: Triple Differences By Gender//////
///////////////////////////////////////////////

preserve 


gen Female=1 if sex==2
replace Female=0 if sex==1

est clear 
eststo: quietly reg employed i.seating_law_control##i.Female i.state##i.Female i.year##i.Female ,cluster(state)
estadd ysumm
eststo: quietly reg employed i.seating_law_control##i.Female  c.age##i.Female  c.race##i.Female  i.hispan##i.Female  i.state##i.Female i.year##i.Female ,cluster(state)
estadd ysumm
eststo: quietly reg employed c.seating_law_years##i.Female  i.state##i.Female i.year##i.Female ,cluster(state)
estadd ysumm
eststo: quietly reg employed c.seating_law_years##i.Female c.age##i.Female  c.race##i.Female  i.hispan##i.Female i.state##i.Female i.year##i.Female , cluster(state)
estadd ysumm
esttab  using "$root/Results/tableA15_seating.tex", keep(1.seating_law_control 1.Female 1.seating_law_control#1.Female seating_law_years 1.Female#c.seating_law_years ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010)  stats(N ymean ysd , fmt(%9.0fc 2)) 

est clear 
eststo: quietly reg employed i.prohibitory_law_control##i.Female i.state##i.Female i.year##i.Female ,cluster(state)
estadd ysumm
eststo: quietly reg employed i.prohibitory_law_control##i.Female c.age##i.Female  c.race##i.Female  i.hispan##i.Female i.state##i.Female i.year##i.Female  ,cluster(state)
estadd ysumm
eststo: quietly reg employed c.regulatory_years##i.Female  i.state##i.Female i.year##i.Female  ,cluster(state)
estadd ysumm
eststo: quietly reg employed c.regulatory_years##i.Female c.age##i.Female  c.race##i.Female  i.hispan##i.Female i.state##i.Female i.year##i.Female  ,cluster(state)
estadd ysumm
esttab  using "$root/Results/tableA15_regulatory.tex", keep(1.prohibitory_law_control 1.Female 1.prohibitory_law_control#1.Female regulatory_years 1.Female#c.regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

est clear 
eststo: quietly reg employed i.night_work_law_control##i.Female i.state##i.Female i.year##i.Female ,cluster(state)
estadd ysumm
eststo: quietly reg employed i.night_work_law_control##i.Female c.age##i.Female  c.race##i.Female  i.hispan##i.Female i.state##i.Female i.year##i.Female  ,cluster(state)
estadd ysumm
eststo: quietly reg employed c.nightwork_years##i.Female  i.state##i.Female i.year##i.Female ,cluster(state)
estadd ysumm
eststo: quietly reg employed c.nightwork_years##i.Female c.age##i.Female  c.race##i.Female  i.hispan##i.Female i.state##i.Female i.year##i.Female  ,cluster(state)
estadd ysumm
esttab  using "$root/Results/tableA15_nightwork.tex", keep(1.night_work_law_control 1.Female 1.night_work_law_control#1.Female  nightwork_years 1.Female#c.nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

restore 





///////////////////////////////////////
//Table A16: By Age Categories /////// 
//////////////////////////////////////

preserve 
keep if sex==2 

**Panel A: Binary regressions
*Seating laws:
est clear 
eststo: quietly reg employed seating_law_control age race hispan i.state i.year  if age>16 & age<=25,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year  if age>16 & age<=25 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_control age race hispan i.state i.year  if  age>25 & age<=35 ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year  if  age>25 & age<=35 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_control age race hispan i.state i.year  if age>35 & age<=45,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year  if age>35 & age<=45 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_control age race hispan i.state i.year if  age>45 & age<65,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year if  age>45 & age<65 & restricted_sample==1,cluster(state)
estadd ysumm


esttab  using "$root/Results/tableA16_A_seating.tex", keep(seating_law_control) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

*wRegulatory Laws
est clear
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year  if  age>16 & age<=25,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year  if  age>16 & age<=25 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year  if  age>25 & age<=35,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year  if  age>25 & age<=35 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year  if  age>35 & age<=45,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year  if  age>35 & age<=45 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year  if age>45 & age<65,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year  if age>45 & age<65 & restricted_sample==1,cluster(state)
estadd ysumm


esttab  using "$root/Results/tableA16_A_regulatory.tex", keep(prohibitory_law_control) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

*Nightwork Laws
est clear
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year  if age>16 & age<=25,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year  if age>16 & age<=25 & restricted_sample==1,cluster(state)
estadd ysumm


eststo: quietly reg employed night_work_law_control age race hispan i.state i.year  if age>25 & age<=35,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year  if age>25 & age<=35 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed night_work_law_control age race hispan i.state i.year if age>35 & age<=45,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year if age>35 & age<=45 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed night_work_law_control age race hispan i.state i.year if age>45 & age<65,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year if age>45 & age<65 & restricted_sample==1,cluster(state)
estadd ysumm


esttab  using "$root/Results/tableA16_A_nightwork.tex", keep(night_work_law_control) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

**Panel B: Continuous regressions
*Seating laws:
est clear 
eststo: quietly reg employed seating_law_years age race hispan i.state i.year  if age>16 & age<=25,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year  if age>16 & age<=25 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_years age race hispan i.state i.year  if  age>25 & age<=35 ,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year  if  age>25 & age<=35 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_years age race hispan i.state i.year  if age>35 & age<=45,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year  if age>35 & age<=45 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_years age race hispan i.state i.year if  age>45 & age<65,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year if  age>45 & age<65 & restricted_sample==1,cluster(state)
estadd ysumm


esttab  using "$root/Results/tableA16_B_seating.tex", keep(seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

*wRegulatory Laws
est clear
eststo: quietly reg employed regulatory_years age race hispan i.state i.year  if  age>16 & age<=25,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year  if  age>16 & age<=25 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed regulatory_years age race hispan i.state i.year  if  age>25 & age<=35,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year  if  age>25 & age<=35 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed regulatory_years age race hispan i.state i.year  if  age>35 & age<=45,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year  if  age>35 & age<=45 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed regulatory_years age race hispan i.state i.year  if age>45 & age<65,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year  if age>45 & age<65 & restricted_sample==1,cluster(state)
estadd ysumm


esttab  using "$root/Results/tableA16_B_regulatory.tex", keep(regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

*Nightwork Laws
est clear
eststo: quietly reg employed nightwork_years age race hispan i.state i.year  if age>16 & age<=25,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year  if age>16 & age<=25 & restricted_sample==1,cluster(state)
estadd ysumm


eststo: quietly reg employed nightwork_years age race hispan i.state i.year  if age>25 & age<=35,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year  if age>25 & age<=35 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed nightwork_years age race hispan i.state i.year if age>35 & age<=45,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year if age>35 & age<=45 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed nightwork_years age race hispan i.state i.year if age>45 & age<65,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year if age>45 & age<65 & restricted_sample==1,cluster(state)
estadd ysumm


esttab  using "$root/Results/tableA16_B_nightwork.tex", keep(nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 


restore 


///////////////////////////////////////////////////
//Table A17: Race, Nativity and Hispanic Status///
//////////////////////////////////////////////////

preserve 
keep if sex==2 


**Panel A: White vs Non White

*Seating laws:

eststo: quietly reg employed seating_law_control age i.state i.year  if white==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age i.state i.year  if white==1 & restricted_sample==1,cluster(state)
estadd ysumm


eststo: quietly reg employed seating_law_control age  i.state i.year  if white==0,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age  i.state i.year  if white==0 & restricted_sample==1,cluster(state)
estadd ysumm


eststo: quietly reg employed seating_law_years age i.state i.year  if white==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age i.state i.year  if white==1 & restricted_sample==1,cluster(state)
estadd ysumm


eststo: quietly reg employed seating_law_years age  i.state i.year  if white==0,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age  i.state i.year  if white==0 & restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA17_A_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 


*regulatory
est clear 
eststo: quietly reg employed prohibitory_law_control  age i.state i.year  if white==1,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control  age i.state i.year  if white==1  & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed prohibitory_law_control age  i.state i.year  if  white==0,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age  i.state i.year  if  white==0  & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed regulatory_years  age i.state i.year  if white==1,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years  age i.state i.year  if white==1  & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed regulatory_years age  i.state i.year  if  white==0,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age  i.state i.year  if  white==0  & restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA17_A_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 


*nightwork 
est clear 
eststo: quietly reg employed night_work_law_control age i.state i.year  if  white==1,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age i.state i.year  if  white==1& restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed night_work_law_control age  i.state i.year  if  white==0,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age  i.state i.year  if  white==0& restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed nightwork_years age i.state i.year  if  white==1,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age i.state i.year  if  white==1& restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed nightwork_years age  i.state i.year  if  white==0,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age  i.state i.year  if  white==0& restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA17_A_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 



*** Panel B: Native versus foreign
est clear 
*seating 
eststo: quietly reg employed seating_law_control age  i.state i.year if  native==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age  i.state i.year if  native==1 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_control age  i.state i.year  if  native==0,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age  i.state i.year  if  native==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_years age  i.state i.year if  native==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age  i.state i.year if  native==1 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_years age  i.state i.year  if  native==0,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age  i.state i.year  if  native==0 & restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA17_B_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 


*regulatory
est clear 
eststo: quietly reg employed prohibitory_law_control age  i.state i.year  if  native==1,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age  i.state i.year  if  native==1 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed prohibitory_law_control age  i.state i.year  if native==0,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age  i.state i.year  if native==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed regulatory_years age  i.state i.year  if  native==1,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age  i.state i.year  if  native==1 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed regulatory_years age  i.state i.year  if native==0,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age  i.state i.year  if native==0 & restricted_sample==1,cluster(state)
estadd ysumm
esttab  using "$root/Results/tableA17_B_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

*nightwork
est clear 
eststo: quietly reg employed night_work_law_control age  i.state i.year  if  native==1,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age  i.state i.year  if  native==1 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed night_work_law_control age  i.state i.year if  native==0,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age  i.state i.year if  native==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed nightwork_years age  i.state i.year  if  native==1,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age  i.state i.year  if  native==1 & restricted_sample==1,cluster(state)
estadd ysumm 

eststo: quietly reg employed nightwork_years age  i.state i.year if  native==0,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age  i.state i.year if  native==0 & restricted_sample==1,cluster(state)
estadd ysumm
esttab  using "$root/Results/tableA17_B_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 



** Panel C: Hispanic vs Non Hispanic
*seating 
est clear 
eststo: quietly reg employed seating_law_control age  i.state i.year  if  hispanic==0,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age  i.state i.year  if  hispanic==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_control age i.state i.year  if hispanic==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age i.state i.year  if hispanic==1 & restricted_sample==1,cluster(state)
estadd ysumm



eststo: quietly reg employed seating_law_years age  i.state i.year  if  hispanic==0,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age  i.state i.year  if  hispanic==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed seating_law_years age i.state i.year  if hispanic==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age i.state i.year  if hispanic==1 & restricted_sample==1,cluster(state)
estadd ysumm



esttab  using "$root/Results/tableA17_C_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

*Regulatory Laws:
est clear 
eststo: quietly reg employed prohibitory_law_control  age  i.state i.year  if  hispanic==0,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control  age  i.state i.year  if  hispanic==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed prohibitory_law_control age i.state i.year  if  hispanic==1,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age i.state i.year  if  hispanic==1 & restricted_sample==1,cluster(state)
estadd ysumm


eststo: quietly reg employed regulatory_years  age  i.state i.year  if  hispanic==0,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years  age  i.state i.year  if  hispanic==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed regulatory_years age i.state i.year  if  hispanic==1,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age i.state i.year  if  hispanic==1 & restricted_sample==1,cluster(state)
estadd ysumm


esttab  using "$root/Results/tableA17_C_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

*Night work Laws:
est clear 
eststo: quietly reg employed night_work_law_control age  i.state i.year if hispanic==0,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age  i.state i.year if hispanic==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed night_work_law_control age i.state i.year  if hispanic==1,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age i.state i.year  if hispanic==1 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed nightwork_years age  i.state i.year if hispanic==0,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age  i.state i.year if hispanic==0 & restricted_sample==1,cluster(state)
estadd ysumm

eststo: quietly reg employed nightwork_years age i.state i.year  if hispanic==1,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age i.state i.year  if hispanic==1 & restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA17_C_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

restore 



/////////////////////////////////////////
//Table A18: Urban/Rural Heterogeneity/// 
/////////////////////////////////////////

preserve 

keep if sex==2 

*Panel A: Rural 
est clear 
eststo: quietly reg employed seating_law_control i.state i.year  if urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year if  urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year  if restricted_sample==1 & urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years  i.state i.year  if urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year  if  urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year  if restricted_sample==1 & urban==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA18_A_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 


est clear 
eststo: quietly reg employed prohibitory_law_control i.state i.year if urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year if urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year if sex==2 & restricted_sample==1 & urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years  i.state i.year  if urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year  if urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year  if restricted_sample==1 & urban==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA18_A_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

est clear 
eststo: quietly reg employed night_work_law_control i.state i.year  if urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year  if  urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year  if  restricted_sample==1 & urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years  i.state i.year if  urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year if  urban==1,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year  if restricted_sample==1 & urban==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA18_A_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

*Panel B: Urban

est clear 
eststo: quietly reg employed seating_law_control i.state i.year if  urban==2,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year if  urban==2,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_control age race hispan i.state i.year if restricted_sample==1 & urban==2,cluster(state)
eststo: quietly reg employed seating_law_years  i.state i.year if urban==2,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year  if urban==2,cluster(state)
estadd ysumm
eststo: quietly reg employed seating_law_years age race hispan i.state i.year  if restricted_sample==1 & urban==2,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA18_B_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 


est clear 
eststo: quietly reg employed prohibitory_law_control i.state i.year  if  urban==2,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year if  urban==2,cluster(state)
estadd ysumm
eststo: quietly reg employed prohibitory_law_control age race hispan i.state i.year  if restricted_sample==1 & urban==2,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years  i.state i.year if urban==2,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year if  urban==2,cluster(state)
estadd ysumm
eststo: quietly reg employed regulatory_years age race hispan i.state i.year if  restricted_sample==1 & urban==2,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA18_B_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

est clear 
eststo: quietly reg employed night_work_law_control i.state i.year  if  urban==2,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year  if  urban==2,cluster(state)
estadd ysumm
eststo: quietly reg employed night_work_law_control age race hispan i.state i.year  if restricted_sample==1 & urban==2,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years  i.state i.year if urban==2,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year  if urban==2,cluster(state)
estadd ysumm
eststo: quietly reg employed nightwork_years age race hispan i.state i.year  if  restricted_sample==1 & urban==2,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA18_B_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 

restore 





//////////////////////////////////////
//Table A19: Suitable Occupations ///
/////////////////////////////////////

preserve 

keep if sex==2 

gen employed_suitable=0 if employed==0
replace employed_suitable=1 if occ1950==056 | occ1950==059 | occ1950==058 | occ1950==078 | occ1950==079| occ1950==093| occ1950==390| occ1950==301| occ1950==310| occ1950==320| occ1950==350| occ1950==490| occ1950==500| occ1950==640| occ1950==643| occ1950==645| occ1950==675| occ1950==684| occ1950==690| occ1950==730| occ1950==731| occ1950==732| occ1950==740| occ1950==752| occ1950==753| occ1950==754| occ1950==764| occ1950==781| occ1950==784| occ1950==790| occ1950==970

est clear 
eststo: quietly reg employed_suitable seating_law_control i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed_suitable seating_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_suitable seating_law_years  i.state i.year  ,cluster(state)
estadd ysumm
eststo: quietly reg employed_suitable seating_law_years age race hispan i.state i.year ,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA19_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 


est clear 
eststo: quietly reg employed_suitable prohibitory_law_control i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_suitable prohibitory_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_suitable regulatory_years  i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_suitable regulatory_years age race hispan i.state i.year,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA19_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))  

est clear 
eststo: quietly reg employed_suitable night_work_law_control i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_suitable night_work_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_suitable nightwork_years  i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_suitable nightwork_years age race hispan i.state i.year,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA19_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2)) 


restore 


//////////////////////////////////////
//Table A20: Dominated Industries////
/////////////////////////////////////
preserve 

keep if sex==2 

*panel A
est clear 
eststo: quietly reg employed_male_dominated seating_law_control i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated seating_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated seating_law_control age race hispan i.state i.year  if  restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated seating_law_years  i.state i.year  ,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated seating_law_years age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated seating_law_years age race hispan i.state i.year  if  restricted_sample==1,cluster(state)
estadd ysumm
esttab  using "$root/Results/tableA20_A_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

est clear 
eststo: quietly reg employed_male_dominated prohibitory_law_control i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated prohibitory_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated prohibitory_law_control age race hispan i.state i.year  if  restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated regulatory_years  i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated regulatory_years age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated regulatory_years age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA20_A_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

est clear 
eststo: quietly reg employed_male_dominated night_work_law_control i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated night_work_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated night_work_law_control age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated nightwork_years  i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated nightwork_years age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_male_dominated nightwork_years age race hispan i.state i.year  if  restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA20_A_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))



*panel B
est clear 
eststo: quietly reg employed_female_dominated seating_law_control i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated seating_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated seating_law_control age race hispan i.state i.year if  restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated seating_law_years  i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated seating_law_years age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated seating_law_years age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm



esttab  using "$root/Results/tableA20_B_seating.tex", keep(seating_law_control seating_law_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

est clear 
eststo: quietly reg employed_female_dominated prohibitory_law_control i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated prohibitory_law_control age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated prohibitory_law_control age race hispan i.state i.year if  restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated regulatory_years  i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated regulatory_years age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated regulatory_years age race hispan i.state i.year if restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA20_B_regulatory.tex", keep(prohibitory_law_control regulatory_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) 


est clear 
eststo: quietly reg employed_female_dominated night_work_law_control i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated night_work_law_control age race hispan i.state i.year,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated night_work_law_control age race hispan i.state i.year  if restricted_sample==1,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated nightwork_years  i.state i.year  ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated nightwork_years age race hispan i.state i.year ,cluster(state)
estadd ysumm
eststo: quietly reg employed_female_dominated nightwork_years age race hispan i.state i.year if  restricted_sample==1,cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA20_B_nightwork.tex", keep(night_work_law_control nightwork_years) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd , fmt(%9.0fc 2))

restore 


/////////////////////////////////////////
//Table A21: Occupational Segregation////
/////////////////////////////////////////

preserve 

* use occ1950: 995:Other non-occupational response; 999: blank; 997: Occupation missing/unknown
drop if occ1950==999
drop if occ1950==995
drop if occ1950==997

keep if labforce==2

*To measure the degree of occupational segregation between men and women , I compute the index of dissimilarity proposed by Duncan and Duncan
gen Male=1 if sex==1
gen Female=1 if sex==2


gen pop=1
bysort statefip year industry occ1950: egen maleocc=sum(pop) if Male==1
bysort statefip year industry: egen Malestate=sum(pop) if Male==1

gen Maleratio=maleocc/Malestate

bysort stateicp statefip year  industry occ1950: egen femaleocc=sum(pop) if Female==1
bysort stateicp statefip industry year : egen femalestate=sum(pop) if Female==1

gen Femaleratio=femaleocc/femalestate

collapse (mean) Maleratio Femaleratio, by(statefip year industry occ1950)



* https://en.wikipedia.org/wiki/Duncan_Segregation_Index
bysort statefip year industry occ1950: gen D=Maleratio-Femaleratio

*br stateicp statefip year occ1950 Maleratio maleocc Malestate femaleocc Femaleratio femalestate D


bysort statefip year industry occ1950: gen Dabsolue=abs(D)
drop if D==. 
bysort statefip industry year : egen Dobs=sum(Dabsolue)
bysort statefip industry year: keep if [_n]==1
gen Segregation=0.5*Dobs

*re-merging with state_law
merge m:1 statefip year using "$root/Data/state_laws.dta"

keep if _merge==3
drop _merge


merge 1:1 STATE year industry using "$root/Data/state_year_industry.dta"

keep if _merge==3
drop _merge

*Seating laws 
est clear 
eststo: quietly reg Segregation seating_law_mercantile  i.state i.year if industry=="mercantile",cluster(state)
estadd ysumm
eststo: quietly reg Segregation seating_law_manufacturing  i.state i.year if industry=="manufac_durable",cluster(state)
estadd ysumm
eststo: quietly reg Segregation seating_law_manufacturing  i.state i.year if industry=="manufac_non_durable",cluster(state)
estadd ysumm
eststo: quietly reg Segregation seating_law_personal  i.state i.year if industry=="services",cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA21_seating.tex", keep(seating_law_mercantile seating_law_manufacturing   seating_law_personal ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))

*Regulatory laws: 
est clear 
eststo: quietly reg Segregation prohibitory_law_manufacturing  i.state i.year if industry=="manufac_durable",cluster(state)
estadd ysumm
eststo: quietly reg Segregation prohibitory_law_manufacturing  i.state i.year if industry=="manufac_non_durable",cluster(state)
estadd ysumm
eststo: quietly reg Segregation prohibitory_law_mines  i.state i.year if industry=="mining",cluster(state)
estadd ysumm

esttab  using "$root/Results/tableA21_regulatory.tex", keep(prohibitory_law_manufacturing   prohibitory_law_mines) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))


*Nightwork laws: 
est clear 
eststo: quietly reg Segregation nightwork_law_mercantile  i.state i.year if industry=="mercantile",cluster(state)
estadd ysumm
eststo: quietly reg Segregation nightwork_law_manufacturing  i.state i.year if industry=="manufac_durable",cluster(state)
estadd ysumm
eststo: quietly reg Segregation nightwork_law_manufacturing  i.state i.year if industry=="manufac_non_durable",cluster(state)
estadd ysumm
eststo: quietly reg Segregation nightwork_law_services  i.state i.year if industry=="services",cluster(state)
estadd ysumm
esttab  using "$root/Results/tableA21_nightwork.tex", keep( nightwork_law_mercantile   nightwork_law_manufacturing  nightwork_law_services ) b(3) se(3) r2 starlevels( * 0.10 ** 0.05 *** 0.010) stats(N ymean ysd, fmt(%9.0fc 2))

restore 




/////////////////////////////////////////////
//Figure 2: Chaisemartin and Haultfoeille////
/////////////////////////////////////////////

preserve 

keep if sex==2

   did_multiplegt_old employed state year seating_law_control if restricted_sample==1, graphoptions(nodraw) robust_dynamic dynamic(3) placebo(2) trends_lin(state)  breps(200) cluster(state) seed(1) 
 graph save  "$root/Results/figure2_seating.gph"

   did_multiplegt_old employed state year prohibitory_law_control if restricted_sample==1, graphoptions(nodraw) robust_dynamic dynamic(3) placebo(2) trends_lin(state)  breps(200) cluster(state) seed(1) 
  graph save  "$root/Results/figure2_regulatory.gph"

 
   did_multiplegt_old employed state year night_work_law_control if restricted_sample==1, graphoptions(nodraw) robust_dynamic dynamic(3) placebo(2) trends_lin(state)  breps(200) cluster(state) seed(1) 
  graph save  "$root/Results/figure2_nightwork.gph"
  
restore 





////////////////////////////////////////////
//Figure A1: Gainful Employment Over Time///
////////////////////////////////////////////



**Panel A: male gainful employment over time 
preserve 


egen mean = mean(employed), by(year sex) 
egen sd = sd(employed), by(year sex) 


contract year sex mean sd


drop if mean==.

drop _freq

gen upper = mean + sd 
gen lower = mean - sd 
set scheme s1color 

contract mean sex upper lower year

twoway rcap upper lower year if sex==1, lc(red) || scatter mean year if sex==1, mc(red) ms(S) || rcap upper lower year if sex==2, lc(black) || scatter mean year if sex== 2, mc(black) 

graph save "$root/Results/figureA1_A.gph"

restore 




 **Panel B: Female gainful employment - seating laws
 preserve 
keep if sex==2 

* Step 1: Calculate the interval width
local start_year = 1881
local end_year = 1931
local interval_width = (`end_year' - `start_year' + 1) / 3

gen year_variable=year_seating_law

* Step 2: Create a new variable indicating the group
gen year_group = .
replace year_group = 1 if year_variable >= `start_year' & year_variable < `start_year' + `interval_width'
replace year_group = 2 if year_variable >= `start_year' + `interval_width' & year_variable < `start_year' + 2*`interval_width'
replace year_group = 3 if year_variable >= `start_year' + 2*`interval_width' & year_variable <= `end_year'

egen mean = mean(employed), by(year year_group) 
 
 
contract mean  year year_group
sort year year_group
keep if year<=1940

twoway (scatter mean year if year_group == 1, lc(red) msize(med) mlabel("") mcolor(red)) ||   (scatter mean year if year_group == 2, lc(blue) msize(med) mlabel("") mcolor(blue)) ||  (scatter mean year if year_group == 3, lc(green) msize(med) mlabel("") mcolor(green)), legend(label(1 "Early adopters of seating laws") label(2 "Middle adopters of seating laws") label(3 "Late adopters of seating laws") label(4 "Group 4")) xtitle("Year") ytitle("Mean Value") title("Mean Over Time by Year Group")

graph save "$root/Results/figureA1_B.gph"

restore 



**Panel C: Female gainful employment - regulatory laws
preserve

keep if sex==2 

* Step 1: Calculate the interval width
local start_year = 1872
local end_year = 1919
local interval_width = (`end_year' - `start_year' + 1) / 3

gen year_variable=year_prohibitory_law
* Step 2: Create a new variable indicating the group
gen year_group = .
replace year_group = 1 if year_variable >= `start_year' & year_variable < `start_year' + `interval_width'
replace year_group = 2 if year_variable >= `start_year' + `interval_width' & year_variable < `start_year' + 2*`interval_width'
replace year_group = 3 if year_variable >= `start_year' + 2*`interval_width' & year_variable <= `end_year'

 egen mean = mean(employed), by(year year_group) 
 
 
contract mean  year year_group
sort year year_group
keep if year<=1940

twoway (scatter mean year if year_group == 1, lc(red) msize(med) mlabel("") mcolor(red)) ||   (scatter mean year if year_group == 2, lc(blue) msize(med) mlabel("") mcolor(blue)) ||  (scatter mean year if year_group == 3, lc(green) msize(med) mlabel("") mcolor(green)), legend(label(1 "Early adopters regulatory laws") label(2 "Middle adopters regulatory laws") label(3 "Late adopters regulatory laws")) xtitle("Year") ytitle("Mean Value") title("Mean Over Time by Year Group")

graph save  "$root/Results/figureA1_C.gph"

restore 



**panel D: Female gainful employment - nightwork laws 
preserve

keep if sex==2 

* Step 1: Calculate the interval width
local start_year = 1889
local end_year = 1921
local interval_width = (`end_year' - `start_year' + 1) / 3

gen year_variable=year_night_work
* Step 2: Create a new variable indicating the group
gen year_group = .
replace year_group = 1 if year_variable >= `start_year' & year_variable < `start_year' + `interval_width'
replace year_group = 2 if year_variable >= `start_year' + `interval_width' & year_variable < `start_year' + 2*`interval_width'
replace year_group = 3 if year_variable >= `start_year' + 2*`interval_width' & year_variable <= `end_year'

 egen mean = mean(employed), by(year year_group) 
 
 
contract mean  year year_group
sort year year_group
keep if year<=1940

twoway (scatter mean year if year_group == 1, lc(red) msize(med) mlabel("") mcolor(red)) ||   (scatter mean year if year_group == 2, lc(blue) msize(med) mlabel("") mcolor(blue)) ||  (scatter mean year if year_group == 3, lc(green) msize(med) mlabel("") mcolor(green)), legend(label(1 "Early adopters night-work laws") label(2 "Middle adopters night-work laws") label(3 "Late adopters night-work laws")) xtitle("Year") ytitle("Mean Value") title("Mean Over Time by Year Group")

graph save  "$root/Results/figureA1_D.gph"

restore 

////////////////////////////////////////////
//Figure A2: TWFE - Dynamic - women/////////
////////////////////////////////////////////
preserve 

keep if sex==2 

drop _merge 
merge m:1 STATE year using "$root/Data/state_laws_panel.dta"


est clear
eststo: quietly reg employed tminus8_s tminus7_s tminus6_s tminus5_s tminus4_s tminus3_s tminus2_s tminus1_omitted t_s tplus1_s tplus2_s tplus3_s tplus4_s tplus5_s age race hispan i.year i.state  if restricted_sample==1,cluster(state)
estimates store decade_estimates
	  coefplot decade_estimates, omitted drop(*.year *.state age hispan race _cons tminus8_s tminus7_s tminus6_s tminus5_s tminus4_s tplus4_s tplus5_s)  vertical yscale(range(-0.05 0.15)) ylabel(-0.05(0.05)0.15) yline(0) recast(connected)  ciopts(recast(rcap)) citop levels(95)
graph save "$root/Results/figureA2_seating.gph"
	  

est clear 
eststo: quietly reg employed tminus6_r tminus5_r tminus4_r tminus3_r tminus2_r tminus1_omitted t_r tplus1_r tplus2_r tplus3_r tplus4_r tplus5_r tplus6_r age race hispan i.year i.state if restricted_sample==1,cluster(state)
estimates store decade_estimates
	  coefplot decade_estimates, omitted drop(*.year *.state age hispan race _cons tminus6_r tminus5_r tminus4_r tplus4_r tplus5_r tplus6_r)  vertical yscale(range(-0.05 0.1)) ylabel(-0.05(0.05)0.1) yline(0) recast(connected)  ciopts(recast(rcap)) citop levels(95)
graph save  "$root/Results/figureA2_regulatory.gph"


est clear
eststo: quietly reg employed tminus7_n tminus6_n tminus5_n tminus4_n tminus3_n tminus2_n tminus1_omitted t_n tplus1_n tplus2_n tplus3_n tplus4_n tplus5_n age race hispan i.year i.state if restricted_sample==1,cluster(state)
estimates store decade_estimates
	  coefplot decade_estimates,omitted drop(*.year *.state age hispan race _cons tminus7_n tminus6_n tminus5_n tminus4_n tplus4_n tplus5_n)  vertical yscale(range(-0.05 0.1)) ylabel(-0.05(0.05)0.1)  yline(0) recast(connected)  ciopts(recast(rcap)) citop levels(95)
graph save  "$root/Results/figureA2_nightwork.gph"


restore 

////////////////////////////////////////////////
//Figure A3: Female Occupations, by Industry///
///////////////////////////////////////////////

*pie chart mercantile: 
preserve 

keep if sex==2 
keep if mercantile==1
gen pop=1

contract pop occ1950
rename _freq  total_mercantile
gsort -total_mercantile
keep if [_n]<=5
decode occ1950,gen(occupation)
graph pie total_mercantile,over(occupation)

graph save "$root/Results/figureA3_mercantile.gph"
restore 

*pie chart manufacturing durable: 
preserve 

keep if sex==2 
keep if manufac_durable==1
gen pop=1

contract pop occ1950
rename _freq total_manufac_durable
gsort -total_manufac_durable
keep if [_n]<=5
decode occ1950,gen(occupation)
graph pie total_manufac_durable,over(occupation)

graph save "$root/Results/figureA3_manufac_durable.gph"

restore 

*pie chart manufacturing non durable:  

preserve

keep if sex==2
keep if manufac_non_durable==1
gen pop=1

contract pop occ1950 
rename _freq total_manufac_non_durable
gsort -total_manufac_non_durable
keep if [_n]<=5
decode occ1950,gen(occupation)
graph pie total_manufac_non_durable,over(occupation)

graph save "$root/Results/figureA3_manufac_nondurable.gph"

restore 

*pie chart mining:
preserve 

keep if sex==2  
keep sex mining occ1950 
keep if mining==1
gen pop=1 

contract pop occ1950
rename _freq  total_mining
gsort -total_mining
keep if [_n]<=5
decode occ1950,gen(occupation)
graph pie total_mining,over(occupation)

graph save "$root/Results/figureA3_mining.gph"
restore 


*pie chart services:

preserve

keep if sex==2  
keep if services==1
gen pop=1

contract pop occ1950
rename _freq total_services
gsort -total_services
keep if [_n]<=5
decode occ1950,gen(occupation)
graph pie total_services,over(occupation)

graph save "$root/Results/figureA3_services.gph"

restore 

*for services (restricted):

preserve 

keep if sex==2 
keep if services==1
keep if restricted==1
gen pop=1

contract pop occ1950
rename _freq total_services_restricted
gsort -total_services_restricted
keep if [_n]<=5
decode occ1950,gen(occupation)
graph pie total_services_restricted,over(occupation)

graph save "$root/Results/figureA3_services_restricted.gph"

restore 



////////////////////////////////////////////
//Figure A4: TWFE - Dynamic - men///////////
////////////////////////////////////////////
preserve 

keep if sex==1 
drop _merge 
merge m:1 STATE year using "$root/Data/state_laws_panel.dta"



est clear
eststo: quietly reg employed tminus8_s tminus7_s tminus6_s tminus5_s tminus4_s tminus3_s tminus2_s tminus1_omitted t_s tplus1_s tplus2_s tplus3_s tplus4_s tplus5_s age race hispan i.year i.state,cluster(state)
estimates store decade_estimates
	  coefplot decade_estimates, omitted drop(*.year *.state age hispan race _cons tminus8_s tminus7_s tminus6_s tminus5_s tminus4_s tplus4_s tplus5_s)  vertical  yline(0) yscale(range(-0.05 0.1)) ylabel(-0.05(0.05)0.1) yline(0) recast(connected)  ciopts(recast(rcap)) citop levels(95)
graph save  "$root/Results/figureA4_seating.gph"
	  

est clear 
eststo: quietly reg employed tminus6_r tminus5_r tminus4_r tminus3_r tminus2_r tminus1_omitted t_r tplus1_r tplus2_r tplus3_r tplus4_r tplus5_r tplus6_r age race hispan i.year i.state,cluster(state)
estimates store decade_estimates
	  coefplot decade_estimates, omitted drop(*.year *.state age hispan race _cons tminus6_r tminus5_r tminus4_r tplus4_r tplus5_r tplus6_r)  vertical yscale(range(-0.05 0.1)) ylabel(-0.05(0.05)0.1) yline(0) recast(connected)  ciopts(recast(rcap)) citop levels(95)
graph save "$root/Results/figureA4_regulatory.gph"


est clear
eststo: quietly reg employed tminus7_n tminus6_n tminus5_n tminus4_n tminus3_n tminus2_n tminus1_omitted t_n tplus1_n tplus2_n tplus3_n tplus4_n tplus5_n age race hispan i.year i.state,cluster(state)
estimates store decade_estimates
	  coefplot decade_estimates,omitted drop(*.year *.state age hispan race _cons tminus7_n tminus6_n tminus5_n tminus4_n tplus4_n tplus5_n)  vertical yscale(range(-0.05 0.1)) ylabel(-0.05(0.05)0.1) yline(0) recast(connected)  ciopts(recast(rcap)) citop levels(95)
graph save "$root/Results/figureA4_nightwork.gph"

restore







